<template>
  <el-input v-if="isEdit" v-model="editValue"></el-input>
  <el-input v-else v-model="echoValue"></el-input>
</template>
<script setup lang="ts">
import { ref } from "vue";
const isEdit = ref(false);
const echoValue = ref("123**1321");
const editValue = ref("");
const rule = {
  validator: (rule, value, callback) => {
    const reg = /电话号码/;
    if (!value.isEdit) {
      callback();
    } else {
      if (reg.test(value.value)) {
        callback();
      } else {
        return callback(new Error("电话号码"));
      }
    }
  },
  trigger: "change",
};
</script>
